package com.press.services;

import com.press.bean.ContentBean;
import com.press.mapper.ExampleMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by haocongshun on 2016/10/18.
 */
@Service("exampleService")
public class ExampleService {
    @Resource(name = "exampleMapper")
    private ExampleMapper exampleMapper;

    public ExampleMapper getExampleMapper() {
        return exampleMapper;
    }

    public void setExampleMapper(ExampleMapper exampleMapper) {
        this.exampleMapper = exampleMapper;
    }

    public List<ContentBean> getContent(int pageNow){
        pageNow = 6*(pageNow-1);
        return exampleMapper.getContent(pageNow);
    }
    public int getPageCount(){
        int count = exampleMapper.getCount();
        return (int)Math.ceil(count/6.0);
    }
}
